<style>
  .text{
    text-align: center;
    color: #000;
    font-size: 17px;
  }
  .text span{
    margin-left: 20px;
  }
</style>
<form class="layui-form" action="admin.html#/shop/order/printOrderDetail">
    <div class="layui-form-item">
      <label class="layui-form-label">二维码{$data.order_on}</label>
      <div class="layui-input-block">
        <input id="codeinput" type="text" name="uid" required  lay-verify="required" placeholder="请扫描二维码" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <div class="layui-input-block">
        <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
        <!-- <button type="reset" class="layui-btn layui-btn-primary">重置</button> -->
      </div>
    </div>
    <div class="text">

    </div>
  </form>
   
  <script>
  var codeinput = document.getElementById('codeinput')
  //Demo
  layui.use('form', function(){
    var form = layui.form;
    //监听提交
    form.on('submit(formDemo)', function(data){
      console.log(data);
      $.ajax({
        //请求方式
        type : "POST",
        //请求的媒体类型
        // contentType: "application/x;charset=UTF-8",
        //请求地址
        url : "/shop/order/printOrderDetail",
        //数据，json字符串
        data : {'uid' : data.field.uid},
        //请求成功
        success : function(result) {
            var res = JSON.parse(result)
            console.log(res)
            if(res.errCode){
                alert(res.errText)
            }
            if (res.goods_title) {
            //   var text = '<span>'+'订单号:'+res.order_on+'</span>'+'<span>'+'姓名:'+res.userName+'</span>'+'<span>'+'手机号码:'+res.userPhone+'</span>'+'<span>'+'商品详情:'+res.goods_title+'</span>';
              var text = '<span>'+'<span>'+'姓名：'+res.userName+'</span>'+'<span>'+'手机号码：'+res.userPhone+'</span>'+'<span>'+'商品详情：'+res.goods_title+'</span>';
            }else{
              var text = '暂无这个订单！';
            }
            codeinput.value='';//框清空输入框之前的内容
            // codeinput.value=data.field.uid;//将微信昵称给到输入
            $('.text').text('');
            $('.text').append(text);
        },
        //请求失败，包含具体的错误信息
        error : function(e){
            console.log(e.status);
            console.log(e.responseText);
        }
      });
      return false;
    });
  });
  </script>
        